# -*- coding: utf-8 -*-

from matplotlib import pyplot
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler, MinMaxScaler, RobustScaler, Normalizer


def test_standard_scaler():
    # 标准正态分布

    x, y = make_blobs(n_samples=40, centers=2, random_state=50, cluster_std=2)
    x = StandardScaler().fit_transform(X=x)
    pyplot.scatter(x=x[:, 0], y=x[:, 1], c=y, cmap=pyplot.cool())
    pyplot.show()

    pass


def test_min_max_scaler():
    # 最小值最大值
    x, y = make_blobs(n_samples=40, centers=2, random_state=50, cluster_std=2)
    x = MinMaxScaler().fit_transform(X=x)
    pyplot.scatter(x=x[:, 0], y=x[:, 1], c=y, cmap=pyplot.cool())
    pyplot.show()
    pass


def test_robust_scaler():
    #
    x, y = make_blobs(n_samples=40, centers=2, random_state=50, cluster_std=2)
    x = RobustScaler().fit_transform(X=x)
    pyplot.scatter(x=x[:, 0], y=x[:, 1], c=y, cmap=pyplot.cool())
    pyplot.show()
    pass


def test_normalizer():
    #
    x, y = make_blobs(n_samples=40, centers=2, random_state=50, cluster_std=2)
    x = Normalizer().fit_transform(X=x)
    pyplot.scatter(x=x[:, 0], y=x[:, 1], c=y, cmap=pyplot.cool())
    pyplot.show()
    pass


if __name__ == '__main__':
    # 数据预处理

    test_standard_scaler()

    # test_min_max_scaler()

    # test_robust_scaler()

    # test_normalizer()

    pass
